package models.entities;

import java.util.Date;
import java.util.List;
@Deprecated
public class OrderEntity {

    public List<OrderItem> orderItems;
    public double subtotal;
    public int userId;
    public int id;
    public Date placeDate;
    UserEntity userInfo;

    public OrderEntity(int orderId, List<OrderItem> orderItems) {
        this.id = orderId;
        this.orderItems = orderItems;
    }

    public OrderEntity(int userId) {
        this.userId = userId;
    }

    public OrderEntity(int orderId, List<OrderItem> orderItems, UserEntity user) {
        this(orderId, orderItems);
        this.userInfo = user;
    }

    public double getSubtotal() {
        double total = 0;
        for (OrderItem scItem : orderItems) {
            total += scItem.subtotal;
        }
        return total;
    }
}
